package ClassDay3;

import ClassDay3.Dao.DaoApp;
import ClassDay3.Ie.UserData;
import ClassDay3.Ie.UserDataIe;
import ClassDay3.Service.Service;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.List;

public class TheMain {
    public static void main(String args[]) throws SQLException {
        ApplicationContext ctx = new AnnotationConfigApplicationContext(ScanComp.class);
        DaoApp da = ctx.getBean("DaoApp1", DaoApp.class);
        da.Save();
        Service s1 = ctx.getBean("service", Service.class);
        s1.Save();
        DataSource druid = s1.getDruid(da);
        System.out.println(druid);
        String resource = "DataBaseConfig.xml";
        UserDataIe UDI=ctx.getBean(UserDataIe.class);
        List<UserData> userData = UDI.GetUserNames();
        System.out.println(userData);

    }

}
